<?php require VIEWPATH . ADMIN_DIR . DIRECTORY_SEPARATOR . 'header.php' ?>
<style type="text/css">
	#import {
		position: relative;
		top: 1.4px;
	}
	#import-seats {
		position: relative;
		top: 1.4px;
	}
	th {
		text-align: center;
		background-color: #6FB3E0;
		color: white;
	}
	td {
		text-align: center;
		vertical-align: middle !important;
		background-color: white !important;
	}
	.outer {
		text-align: center;
	}
	.btn-check {
		color: #3DA4FF;
	}
	.table {
		width: inherit;
	}
	.item-table {
		float: left;
	}
	.input-exam {
        margin-left: 8%;
    }
</style>
<div class="page-header">
	<h1>
		学生成绩
		<!-- 教师权限不可编辑 -->
		<?php if($rmxUser['user_type'] != USER_TYPE_TEACHER): ?>
			<small>
				<a href="<?=admin_url('contents/result_major_data')?>" class="blue ml10">
					<i class="ace-icon fa fa-caret-right"></i> 成绩数据管理
				</a>
			</small>
			<small>
				<a href="javascript:" class="blue ml10" id="import">
					<i class="ace-icon fa fa-upload"></i> 导入成绩
				</a>
			</small>
			<small>
				<a href="https://resource.rongmixiao.com/2019/12/18/8ff55ef56872420387b00b48447eabd1.xls" class="blue ml10">
					<i class="ace-icon fa fa-download"></i> 导出成绩模板
				</a>
			</small>
			<small>
				<a href="javascript:" class="blue ml10" id="import-seats">
					<i class="ace-icon fa fa-upload"></i> 导入考场座位
				</a>
			</small>
			<small>
				<a href="https://resource.rongmixiao.com/2019/12/18/6df6b2678a8092739117a15ef3a49335.xls" class="blue ml10">
					<i class="ace-icon fa fa-download"></i> 导出座位模板
				</a>
			</small>
		<?php endif ?>	
	</h1>
</div>
<div class="col-xs-12 content-filter">
	<!-- 筛选 -->
	<div class="widget-box">
		<div class="widget-header">
			<h4 class="widget-title">内容筛选</h4>
			<div class="widget-toolbar">
				<a href="#" data-action="collapse">
					<i class="ace-icon fa fa-chevron-up"></i>
				</a>
				<a href="#" data-action="close">
					<i class="ace-icon fa fa-times"></i>
				</a>
			</div>
		</div>
		<div class="widget-body">
			<div class="widget-main">
				<div class="form-inline" id="data-search">
					<div class="form-inline keyword-search-div" id="div-grade">
						<label class="keyword-search-label">年级</label>
						<div class="keyword-search-box">
							<a href="javascript:;" class="keyword-search-keyword active" data-id="0">全部</a>
							<?php if(isset($data['grades'])): ?>
								<?php foreach($data['grades'] as $grade): ?>
									<a href="javascript:;" class="keyword-search-keyword" data-id="<?=$grade['id']?>"><?=$grade['grade_name']?></a>
								<?php endforeach; ?>
							<?php endif ?>
						</div>
					</div>
				</div>	
			</div>
		</div>
	</div>
</div>


<?php require VIEWPATH . ADMIN_DIR . DIRECTORY_SEPARATOR . 'footer.php' ?>
<script type="text/javascript">
$(function() {

	// 点击关键字
	$("body").on("click", ".keyword-search-keyword", function(){
		var id = $(this).data("id");
		// 高亮当前点击对象
		$(this).parent().find(".keyword-search-keyword").removeClass("active");
		$(this).addClass("active");
		// 筛选
		var xGradeId = $("#div-grade .active").data('id');
		var xLessonId = $("#div-subject .active").data('id');
		var type = $("#div-type .active").data('id');
		window.location.href="<?=admin_url('contents/exam?grade_id=')?>" + xGradeId  + "&lesson_id=" + xLessonId + "&type=" + type;
	});
	// 导入安排
	var upFromurl = '<?=UP_FORM_URL?>';
	var signature = '<?=$signature?>';
	var policy = '<?=$policy?>';
	$("#import").uploader({
		"server": upFromurl,
		"authorization": signature,
		"policy": policy,
		// 只支持上传 xls
		"accept": "xls",
		"callback": function(response) {
			// 上传后的文件名
			var fileLink = upyunUrl + response.url;
			ajax_post("<?= admin_url('import/import_exam') ?>", { fileLink: fileLink}, function(res) {
				// 刷新页面
				location.reload();
			});
		}
	});
});
</script>
